#define paginate(currentPage, totalPage, link)
	#if(totalPage <= 0 || currentPage > totalPage) #return #end
	#setLocal(startPage = currentPage - 4)
	#if (startPage < 1) #setLocal(startPage = 1) #end
	
	#setLocal(endPage = currentPage + 4)
	#if (endPage > totalPage) #setLocal(endPage = totalPage) #end
	
	<div class="pagination">
			#if (currentPage <= 8)
				#setLocal(startPage = 1)
			#end
			#if ((totalPage - currentPage) < 8)
				#setLocal(endPage = totalPage)
			#end
			
			#if (currentPage == 1)
				<span class="disabled prev_page">上页</span>
			#else
				<a href="#(link)#(currentPage - 1)#(append)" class="prev_page">上页</a>
			#end
			
			#if (currentPage > 8)
				<a href="#(link)#(1)#(append)">#(1)</a>
				<a href="#(link)#(2)#(append)">#(2)</a>
				<span class="gap">…</span>
			#end
			
			#for(i : [startPage..endPage])
				#if (currentPage == i)
					<span class="current">#(i)</span>
				#else
					<a href="#(link)#(i)#(append)">#(i)</a>
				#end
			#end
			
			#if ((totalPage - currentPage) >= 8)
				<span class="gap">…</span>
				<a href="#(link)#(totalPage - 1)#(append)">#(totalPage - 1)</a>
				<a href="#(link)#(totalPage)#(append)">#(totalPage)</a>
			#end
			
			#if (currentPage == totalPage)
				<span class="disabled next_page">下页</span>
			#else
				<a href="#(link)#(currentPage + 1)#(append)" class="next_page" rel="next">下页</a>
			#end
	</div>
#end